home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / utility / utilfile / rw2ent15.lha / Raw2Ent.rexx.old < prev   
Text File  |  1996-11-01  |  5KB  |  171 lines

  1. /* Raw2Ent by Tamio Patrick Honma for HHU CWIS-Project
  2.    $VER:1.3.4 (01.11.96)
  3. */
  4. options results
  5. options cache
  6. parse arg source destination tag
  7.  
  8. filename=source
  9. s1=REVERSE(source)
  10. n=VERIFY(s1,':/','m')
  11.  
  12. IF n>0 THEN DO
  13.   filename=REVERSE(LEFT(s1,n-1))
  14. END
  15.  
  16. say 'Filename    = '||filename
  17. say 'Source      = '||source
  18.  
  19. IF RIGHT(destination,1)='/' | RIGHT(destination,1)=':' THEN destination=destination||filename||'.ent'
  20. ELSE destination=destination||'.ent'
  21.  
  22. say 'Destination = '||destination
  23.  
  24. tag=UPPER(tag)
  25.  
  26. IF tag~='HTML' | tag~='TAG' THEN DO
  27.     IF open('env','ENV:cwis/'||filename,'r') THEN DO
  28.         tag=UPPER(readln('env'))
  29.         close('env')
  30.         say(tag)
  31.     END
  32. END
  33.  
  34.  
  35. IF tag='HTML' THEN address command 'copy '||source||' '||destination
  36. ELSE DO
  37.  
  38.     IF tag='TAG' THEN say('----> TAG-Mode avtivated! The chars: < > & " will not be converted <----')
  39.     ELSE tag=''
  40.  
  41.     IF open('raw',source,'r') THEN DO
  42.         say('opened:'||source)
  43.         IF open('ent',destination,'w') THEN DO
  44.             say('opened:'||destination)
  45.             len=seek('raw',0,'E')
  46.             say('size='||len)
  47.             dumm=seek('raw',0,'B')
  48.             DO i=1 TO len
  49.                 c=readch('raw',1)
  50.                 IF BITTST(c,7) | c='>' | c='<' | c='"' | c='&' THEN DO
  51.                     say('found:'||c||' at '||i)
  52.                     SELECT
  53.                         when c='ä' then c='ä'
  54.                         when c='Ä' then c='Ä'
  55.                         when c='ö' then c='ö'
  56.                         when c='Ö' then c='Ö'
  57.                         when c='ü' then c='ü'
  58.                         when c='Ü' then c='Ü'
  59.                         when c='ï' then c='ï'
  60.                         when c='Ï' then c='Ï'
  61.                         when c='ÿ' then c='ÿ'
  62.                         when c='ë' then c='ë'
  63.                         when c='Ë' then c='Ë'
  64.                         when c='©' then c='©'
  65.                         when c='®' then c='®'
  66.                         when c='þ' then c='Þ'
  67.                         when c='Þ' then c='þ'
  68.                         when c='Ð' then c='Ð'
  69.                         when c='ð' then c='ð'
  70.                         when c=' ' then c=' '
  71.                         when c='è' then c='è'
  72.                         when c='È' then c='È'
  73.                         when c='ò' then c='ò'
  74.                         when c='Ò' then c='Ò'
  75.                         when c='ù' then c='ù'
  76.                         when c='Ù' then c='Ù'
  77.                         when c='ì' then c='ì'
  78.                         when c='Ì' then c='Ì'
  79.                         when c='à' then c='à'
  80.                         when c='À' then c='À'
  81.                         when c='é' then c='é'
  82.                         when c='É' then c='É'
  83.                         when c='ó' then c='ó'
  84.                         when c='Ó' then c='Ó'
  85.                         when c='ú' then c='ú'
  86.                         when c='Ú' then c='Ú'
  87.                         when c='í' then c='í'
  88.                         when c='Í' then c='Í'
  89.                         when c='á' then c='á'
  90.                         when c='Á' then c='Á'
  91.                         when c='ý' then c='ý'
  92.                         when c='Ý' then c='Ý'
  93.                         when c='ê' then c='ê'
  94.                         when c='Ê' then c='Ê'
  95.                         when c='ô' then c='ô'
  96.                         when c='Ô' then c='Ô'
  97.                         when c='û' then c='û'
  98.                         when c='Û' then c='Û'
  99.                         when c='î' then c='î'
  100.                         when c='Î' then c='Î'
  101.                         when c='â' then c='â'
  102.                         when c='Â' then c='Â'
  103.                         when c='ç' then c='ç'
  104.                         when c='Ç' then c='Ç'
  105.                         when c='ñ' then c='ñ'
  106.                         when c='Ñ' then c='Ñ'
  107.                         when c='õ' then c='õ'
  108.                         when c='Õ' then c='Õ'
  109.                         when c='ã' then c='ã'
  110.                         when c='Ã' then c='Ã'
  111.                         when c='å' then c='å'
  112.                         when c='Å' then c='Å'
  113.                         when c='ß' then c='ß'
  114.                         when c='æ' then c='æ'
  115.                         when c='Æ' then c='Æ'
  116.                         when c='ø' then c='ø'
  117.                         when c='Ø' then c='Ø'
  118.                         when c='¡' then c='¡'
  119.                         when c='¢' then c='¢'
  120.                         when c='£' then c='£'
  121.                         when c='¤' then c='¤'
  122.                         when c='¥' then c='¥'
  123.                         when c='¦' then c='¦'
  124.                         when c='¨' then c='¨'
  125.                         when c='ª' then c='ª'
  126.                         when c='«' then c='«'
  127.                         when c='¬' then c='¬'
  128.                         when c='­' then c='­'
  129.                         when c='¯' then c='¯'
  130.                         when c='°' then c='°'
  131.                         when c='±' then c='±'
  132.                         when c='²' then c='²'
  133.                         when c='³' then c='³'
  134.                         when c='´' then c='´'
  135.                         when c='µ' then c='µ'
  136.                         when c='¶' then c='¶'
  137.                         when c='·' then c='·'
  138.                         when c='¸' then c='¸'
  139.                         when c='¹' then c='¹'
  140.                         when c='º' then c='º'
  141.                         when c='»' then c='»'
  142.                         when c='¼' then c='¼'
  143.                         when c='½' then c='½'
  144.                         when c='¾' then c='¾'
  145.                         when c='¿' then c='¿'
  146.                         when c='×' then c='×'
  147.                         when c='÷' then c='÷'
  148.  
  149.                         when c='>' then IF tag~='TAG' THEN c='>'
  150.                         when c='<' then IF tag~='TAG' THEN c='<'
  151.                         when c='"' then IF tag~='TAG' THEN c='"'
  152.                         when c='&' then IF tag~='TAG' THEN c='&'
  153.                     OTHERWISE
  154.                     END
  155.                     say('      -> '||c)
  156.                 END
  157.                 call writech('ent',c)
  158.             END
  159.             call writeln('ent','')
  160.             call writeln('ent','<!--- entity codes generated on a '||len||' bytes large file on '||DATE()||' by Raw2Ent (c) 1996 TPH --->')
  161.             call close('ent')
  162.             say('closed:'||destination)
  163.             address command 'setenv cwis/'||filename||' TAG'
  164.             address command 'copy env:cwis/ envarc: all'
  165.             say('ENV:'||filename)
  166.         END
  167.         call close('raw')
  168.         say('closed:'||source)
  169.     END
  170. END
  171.